<extend name='layout:index'/>
<block name='content'>
<body class="">
    <div class="wrapper wrapper-content">
    
    <div class="row">
    
            <div class="col-sm-12">
            <ul class="nav nav-tabs text-center">
		       <li class="active"><a data-toggle="tab" href="#tab-1" aria-expanded="true" id="a_one" onclick="f1()" style="width: 300px; background-color: white"> 账号回填</a>
		       </li>
		       <li class=""><a data-toggle="tab" href="#tab-2" aria-expanded="false" id="a_two"  style="width: 300px; background-color: white;">账号回填记录</a>
		       </li>
		   </ul>
		   <div class="tab-content">
	       <div id="tab-1" class="tab-pane active">
            <div class="table-responsive" style="margin-left:10px;margin-top:10px">
		  <form action="__MODULE__/back/backgrand" method="post" name="theForm" onSubmit="return checkForm(this)">
				<table class="table table-bordered">
					<tbody><tr>
						<th colspan="4">当前用户信息：
						
						</th>
					</tr>
					<tr>
						<td>用户名：{$_SESSION['users']['user_name']}</td>
						<td>当前等级：{$user_type['name']}</td>
						<td id='show'>需当前等级回填金额：${$user_type.reg_amount}</td>
						<td>
							<select name="user_type" id="jg" class="form-control" onclick='return fun()'>
								  <option value="selected111">--选择回填等级--</option>
								  <foreach name='type' item='vo'>
								  			<option value="{$vo['id']}">{$vo['name']}</option>
								  </foreach>	
							</select>
							</td>
						<td>当前注册币：${$_SESSION['users']['user_money2']}</td>
					</tr>
				</tbody></table>
		 </div>
		 
	          
		           <div class="col-sm-12">
		      
	            		<div style="margin-top: 10px"><strong>输入安全密码:</strong> </div>
	            		<input name="repassword" id="repassword" value="" class="form-control" type="password">
				<if condition="$is_out eq 0">
					<input class="btn bg-blue color-white" type="submit" style="background-color:blue;color:white;margin-left: 45%;margin-top: 10px"  value="提交"> 
				<else />
					<input class="btn bg-blue color-white" type="submit" style="background-color:blue;color:white;margin-left: 45%;margin-top: 10px" disabled='disabled' value="未出局不能回填"> 
				</if>
				</form>	  
					<p style="color:red;padding-top:3%">(提示：在出局之前请选择您要回填的等级，否则系统将默认当前等级回填！)</p>
					</div>
			
			</div>
			 <div id="tab-2" class="tab-pane">
	           
		           <div class="col-sm-12">
					 <div class="tabs-container">
					 <table id="imgList" class="table table-bordered table-striped table-hover">
					<tbody>
						<tr>
							<th>回填次数</th>
				            <th>回填等级</th>
							<th>回填金额</th>
				            <th>回填时间</th>
						</tr>
						<foreach name='user_update_log' item='vo' key='k'>
						<tr>
							<th>{$k+1}</th>
				            <th>{$vo.change_desc}</th>
							<th>{$vo.user_money2}</th>
				            <th><?php echo date('Y-m-d H:i:s',$vo['change_time']);?></th>
						</tr>
						</foreach>

												</tbody>
				</table>
				<div class="paging">

<script type="Text/Javascript" language="JavaScript">
function fun(){
	a = $('#jg').find('option:selected').val();
    	
    	if(!isNaN(a)){
    		$("#show").html('需要注册积分：$'+a*100);
    		$('#show').css('color','');
    	}else{
    		$("#show").html('选择需要提升的等级');
    		$('#show').css('color','red');
    		
    	}
}
    function checkForm(){
    	a = $('#jg').find('option:selected').val();
    	
    	if(!isNaN(a)){
    		$("#show").html('需要注册积分：$'+a*100);
    		$('#show').css('color','');
    	}else{
    		$("#show").html('选择需要提升的等级');
    		$('#show').css('color','red');
    		
    	}
    	var k = false;
    	if(isNaN(a)){
    			 var txt=  "请 选 择 回 填 等 级";
                    window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.error);
                    return false;
    	}
    	$.ajax({
    		type:'POST',
    		url:'/home/back/backAjax',
    		data:{repassword:$('#repassword').val(),backmoney:$('#jg').find('option:selected').val()},
    		dataType : 'html',
            async : false,
            success : function(str){
                if(str==2){
                   var txt=  "安 全 码 错 误";
                    window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.error);
                    return false;
                }
                if(str==22){
                	var txt=  "账 户 积 分 不 足";
                    window.wxc.xcConfirm(txt, window.wxc.xcConfirm.typeEnum.error);
                    return false;
                }
                if(str==1){
                	k=true;
                }
             }
    	})
    	return k;
    } 
</script>

</div></div></div></div></body>
</block>
